/*
 * Copyright (c) 2020 - present, Inspur Genersoft Co., Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package com.inspur.edp.lcm.metadata.inner.api.enm;

/**
 * 发布的阶段
 */
public enum StageEnum {
    GENERATE(0, "生成代码", 10),
    MAVEN_COMPILE(1, "MAVEN编译", 30),
    EXTEND_COMPILE(2, "扩展编译", 50),
    EXTRACT(3, "提取", 5),
    DEPLOY(4, "部署", 4);
    /**
     * 编号
     */
    int code;
    /**
     * 描述
     */
    String desc;
    /**
     * 所占进度值
     */
    int processValue;

    StageEnum(int code, String desc, int processValue) {
        this.code = code;
        this.desc = desc;
        this.processValue = processValue;
    }

    public int getCode() {
        return code;
    }

    public int getProcessValue() {
        return processValue;
    }

    public static StageEnum getTypeByCode(int code) {
        for (StageEnum stageEnum : StageEnum.values()) {
            if (code == stageEnum.getCode()) {
                return stageEnum;
            }
        }
        return StageEnum.GENERATE;
    }

}
